package com.zlh.controller;

import com.zlh.config.RocketmqProducerUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.Instant;

@RestController
public class HelloController {

//    @Autowired
//    RocketmqProducerUtils rocketmqProducerUtils;

    @RequestMapping("/hello")
    public String hello() {
        return "hello";
    }

    @RequestMapping("/sendMessage")
    public String sendMessage() {
        Instant now = Instant.now();
        RocketmqProducerUtils.sendMessage(now.toString());
        return now.toString();
    }

    @RequestMapping("/batch/sendMessage")
    public String batchSendMessage() {
        Instant now = Instant.now();
        RocketmqProducerUtils.sendBatch("batch-" + now.toString());
        return now.toString();
    }
}
